package com.shaobufan.museum.controllar;

import com.shaobufan.museum.common.BaseResponse;
import com.shaobufan.museum.common.ResultUtils;
import com.shaobufan.museum.pojo.vo.CategoryVo;
import com.shaobufan.museum.service.CategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.shaobufan.museum.contant.CategoryContent.CATEGORY_GET_SUCCESS;

/**
 * 馆藏类别
 */
@RestController
@RequestMapping("/category")
public class CategoryController {
    @Resource
    CategoryService categoryService;

    @ApiOperation("查询所有馆藏类别")
    @GetMapping("/search")
    public BaseResponse<List<CategoryVo>> searchCategory() {
        List<CategoryVo> categoryVoList = categoryService.searchCategory();
        return ResultUtils.success(categoryVoList, CATEGORY_GET_SUCCESS);
    }
}